import { useSelector } from "react-redux";
import "./App.css";

import { ConfigProvider, ThemeConfig, theme } from "antd";

import { RootState } from "./types/store";



function App({ children }: { children: React.ReactNode }) {
  const themeState = useSelector((state: RootState) => state.app.theme);

  const themesConfig: ThemeConfig =
    themeState === "light"
      ? {
          algorithm: [theme.defaultAlgorithm,theme.compactAlgorithm],

        }
      : {
          algorithm: [theme.darkAlgorithm,theme.compactAlgorithm],
        };

  return (
    <section className='appContainer'>
      <ConfigProvider theme={themesConfig}>{children}</ConfigProvider>
    </section>
  );
}
export default App;
